//
//  CYVideoDetail_ShipinTuiJianTableViewCell.m
//  cyydt
//
//  Created by chu on 2019/1/23.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYVideoDetail_ShipinTuiJianTableViewCell.h"
#import "CYHomeVideoDetailsViewController.h"

@implementation CYVideoDetail_ShipinTuiJianTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.timeLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
    self.lijibofangBtn.layer.cornerRadius =  self.lijibofangBtn.frame.size.height / 2;
    self.lijibofangBtn.layer.borderColor = RGBOF(0x666666).CGColor;
    self.lijibofangBtn.layer.borderWidth = 1;
    self.lijibofangBtn.layer.masksToBounds = YES;
}

- (void)setModel:(CYProjectModel *)model{
    _model = model;
    self.timeLabel.hidden = NO;
    self.lijibofangBtn.hidden = NO;
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.cover_url] placeholderImage:[UIImage imageNamed:@"videoPlacehold"]];
    self.timeLabel.text = model.play_time_format;
    self.titleLabel.text = model.title;
    self.cateLabel.text = model.catname;
    [self.bofangBtn setTitle:model.views forState:UIControlStateNormal];

    [self.bofangBtn setImage:[UIImage imageNamed:@"播放(1)1"] forState:UIControlStateNormal];
}

- (void)setHotnewsmodel:(CYProjectModel *)hotnewsmodel{
    _hotnewsmodel = hotnewsmodel;
    self.timeLabel.hidden = YES;
    self.lijibofangBtn.hidden = YES;
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:hotnewsmodel.image] placeholderImage:[UIImage imageWithColor:[UIColor lightGrayColor] Size:self.headImageView.frame.size]];
    self.titleLabel.text = hotnewsmodel.title;
    self.cateLabel.text = hotnewsmodel.big_catname;
    [self.bofangBtn setTitle:[NSString stringWithFormat:@"评论%@",hotnewsmodel.comment_number] forState:UIControlStateNormal];
    [self.bofangBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
}

- (IBAction)bofangAction:(UIButton *)sender {
    CYHomeVideoDetailsViewController *detail = [[CYHomeVideoDetailsViewController alloc] init];
    detail.videoId = [self.model.ID stringValue];
    [[AppDelegate sharedAppDelegate] pushViewController:detail];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
